package com.huishu.goods.controller;


import com.huishu.commons.pojo.BasePage;
import com.huishu.commons.pojo.Result;
import com.huishu.goods.pojo.dto.FindWelfareDTO;
import com.huishu.goods.pojo.dto.MaterialBenefitsCreateDTO;
import com.huishu.goods.pojo.dto.MaterialBenefitsUpdateDTO;
import com.huishu.goods.service.MaterialBenefitsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
* @author generator@ljj
* @since 2023-04-12
*/
@RestController
@RequestMapping("/material-benefits")
@Slf4j
public class MaterialBenefitsController {

    @Autowired
    private MaterialBenefitsService materialBenefitsService;

    @PostMapping("/find-welfare")
    public Result findWelfare(@RequestBody FindWelfareDTO findWelfareDTO){
        return materialBenefitsService.findWelfare(findWelfareDTO);
    }


    @PostMapping("/pageList")
    public Result pageList(@RequestBody BasePage basePage){
        return materialBenefitsService.pageList(basePage);
    }

    @PostMapping("/create")
    public Result create(@RequestBody MaterialBenefitsCreateDTO materialBenefitsCreateDTO){
        return materialBenefitsService.create(materialBenefitsCreateDTO);
    }

    @PostMapping("/update")
    public Result modify(@RequestBody MaterialBenefitsUpdateDTO materialBenefitsUpdateDTO){
        return materialBenefitsService.modify(materialBenefitsUpdateDTO);
    }

    @GetMapping("/findById/{id}")
    public Result findById(@PathVariable Long id){
        return materialBenefitsService.findById(id);
    }

    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Long id){
        return materialBenefitsService.delete(id);
    }
}
